<script src="__STATIC__/js/jquery.js"></script>
<iframe id="mapPage" width="100%" height="100%" frameborder=0
    src="https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=HGIBZ-4EDKU-YEXVI-2S7SO-YIFZF-RXFAO&referer=myapp">
</iframe>
<script src="__STATIC__/layui/layui.js"></script>
<script>
    window.addEventListener('message', function(event) {
        // // 接收位置信息，用户选择确认位置点后选点组件会触发该事件，回传用户的位置信息
        var loc = event.data;
        if (loc && loc.module == 'locationPicker') {
            var lat = loc.latlng.lat;
            var lng = loc.latlng.lng;
            var address = loc.poiaddress;
            var title = loc.poiname;
            var city = loc.cityname;

            console.log(loc)

            parent.$('input[name=address]').val(address);
            parent.$('input[name=lng]').val(lng);
            parent.$('input[name=lat]').val(lat);
            
            layui.use('layer', function(){
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            });
        }
    }, false);
</script>